import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    music: {}, //当前播放音乐
    audio: [], //音乐数组
    tabBarState: false, //tabbar是否存在
    TabBarActive: 0, //tabBar选中状态
  },
  mutations: {
    playMusic(state, song) {
      state.music = song
    },
    musicLstAdd(state, song) {
      state.audio.unshift(song)
    },
    ifTabBar(state, bool) {
      state.tabBarState = bool
    },
    changeTabBarActive(state, id) {
      state.TabBarActive = id
    }
  },
  actions: {
  },
  modules: {
  },
  getters: {
    getMusic(state) {
      return state.music
    },
    getAudio(state) {
      return state.audio
    },
    getTabBarState(state) {
      return state.tabBarState
    },
  },
})
